#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#define path "/tmp/test_fifo"
int main ()
{
  int read_pipe;
  int res =1;
  long bytes=0;
  char buffer[PIPE_BUF+1];
  if (access(path,0)== -1 )
  {
    printf("file %s no found\n",path);
    return -1;
  }
  read_pipe = open(path,O_RDONLY);
  if (read_pipe != -1)
  {
    printf("reading file ..........\n");
    while (res>0)
    {
      res= read(read_pipe,buffer,PIPE_BUF);
      bytes+=res;
    }
    close(read_pipe);  
  }
  else
  {
    printf("open file error \n");

    return -1;
    
  }
  printf("have read size is  %d   .\n",bytes);
  
  return 0;
  


    
  
}

